package com.itheima.d5_tcp2;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        System.out.println("开始接收数据");

        final ServerSocket serverSocket = new ServerSocket(6666);

        while (true) {
            final Socket accept = serverSocket.accept();

            while (true) {
                final InputStream is = accept.getInputStream();

                final DataInputStream dis = new DataInputStream(is);

                final String s = dis.readUTF();

                System.out.println(s);

                serverSocket.close();
            }
        }
    }
}
